From: Caolán McNamara Date: Sat, 4 Jul 2026 14:04:46 +0000 (+0100) Subject: [PATCH] ofz: ignore an advance array shorter than the string X-Git-Tag: archive/raspbian/4%25.2.3-2+rpi1+deb13u7^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4713ef7e09b413461e45e3dd39a636784800b3d3;p=libreoffice.git [PATCH] ofz: ignore an advance array shorter than the string Signed-off-by: Caolán McNamara Change-Id: I6ceec1ecbae58a714d2f45eb786e01b428e6d942 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6114 Reviewed-by: Noel Grandin Tested-by: Jenkins CPCI (cherry picked from commit 6ab602ca281f507f7e637183a49dd514ffb1376b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207656 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 4406da79b0715411528c17f93ae7ebcb29b9a0d2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207677 (cherry picked from commit acf64b67cceecf3d1acd26033668b6673208bcf2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207715 Reviewed-by: Christian Lohmaier Tested-by: Xisco Fauli Reviewed-by: Michael Weghorn Gbp-Pq: Name CVE-2026-63272.diff --- diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 5c16df6e42b..18bdd26c616 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -1274,7 +1274,7 @@ namespace emfio GetFont().GetFamilyName())) { Point aPt; - sal_uInt32 nStringLen, nDXCount; + sal_uInt32 nStringLen(0), nDXCount(0); KernArray aDXAry; SvMemoryStream aMemoryStream(nEscLen); aMemoryStream.WriteBytes(pData.get(), nEscLen); @@ -1293,6 +1293,8 @@ namespace emfio OUString aString = read_uInt16s_ToOUString( aMemoryStream, nStringLen); aMemoryStream.ReadUInt32(nDXCount); + if (nDXCount < o3tl::make_unsigned(aString.getLength())) + nDXCount = 0; if ((static_cast(nDXCount) * sizeof(sal_Int32)) >= (nEscLen - aMemoryStream.Tell())) @@ -1301,7 +1303,7 @@ namespace emfio aDXAry.resize(nDXCount); for (sal_uInt32 i = 0; i < nDXCount; i++) { - sal_Int32 val; + sal_Int32 val(0); aMemoryStream.ReadInt32(val); aDXAry[i] = val; }